<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">

<ui:composition template="#{store.templatePath}/template.xhtml">
    <ui:define name="title">Оформление заказа — оплата</ui:define>

    <ui:define name="menu"></ui:define>
    <ui:define name="cart"></ui:define>
    <ui:define name="sidebar"></ui:define>
    

    <ui:define name="body">
        <script src="/js/jquery.js" type="text/javascript"></script>
        <script type="text/javascript">
             $(document).ready(function() {
                 $("input[name*='paymentType']:first").click();

             });
        </script>


        <div class="orderBreadcrumbs"><span>#{messages.cart}</span> → <span>#{messages.authorization}</span> → <span>#{messages.delivery}</span> → <span class="current">#{messages.pay}</span> → <span>#{messages.confirmation}</span></div>


        <h:form>

            <s:decorate template="/incl/edit.xhtml" id="paymentType">
                <ui:define name="label">Способ оплаты</ui:define>
                <h:selectOneRadio value="#{currentOrder.paymentType}" required="true" layout="pageDirection">
                        <s:convertEntity/>
                        <s:selectItems value="#{paymentTypes}"
                                       var="paymentType"
                                       label="#{paymentType.name} (#{paymentType.fee}%)"
                                       />
                    <a4j:support event="onchange" reRender="paymentTypeDescription" />
                </h:selectOneRadio>
            </s:decorate>

            <s:decorate template="/incl/edit.xhtml" />  <!-- SPACER -->

            <s:decorate template="/incl/edit.xhtml" id="paymentTypeDescription">
                <ui:define name="label">Описание</ui:define>
                <h:outputText value="#{currentOrder.paymentType.description}" />
            </s:decorate>

            <s:decorate template="/incl/edit.xhtml" />  <!-- SPACER -->

            <br style="clear: both;" />

            <s:button view="/order/delivery.xhtml" value="← #{messages.back}" />
            <h:commandButton type="submit" action="#{checkout.submitPay()}" value="#{messages.allRight} →" />
        </h:form>


    </ui:define>

</ui:composition>

</html>